﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<object>" %>

<asp:Content ID="registerTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Dynamic Urls
</asp:Content>

<asp:Content ID="registerContent" ContentPlaceHolderID="MainContent" runat="server">
    <script src="<%=ResolveUrl("~/scripts/MicrosoftAjax.debug.js") %>"></script>
    <script src="<%=ResolveUrl("~/scripts/MicrosoftMVCAjax.debug.js") %>"></script>
    <h2>BeginAjaxForm Example</h2>
    <div id="shirtParams">
    <% using (Ajax.BeginForm("CloseUp", new AjaxOptions { HttpMethod = "Get", UpdateTargetId = "preview", InsertionMode = InsertionMode.Replace })) { %>
        <p>
        Style: <select name="style" id="style">
                            <option value="0">V-Neck</option> 
                            <option value="1">Crew</option> 
                 </select> 
        </p>
        <p>
        Color: <select name="color" id="color"> 
                           <option value="0">Red</option> 
                           <option value="1">Green</option> 
                           <option value="2">Yellow</option> 
                 </select> 
        </p>
        <input type="submit" style="display:none" id="hiddensubmit"></input>
        <script type="text/javascript">
            $(function () {
                $('#style').add('#color').change(function () {
                    //MVC's ajax methods don't handle form submission via javascript correctly, so we 
                    //use a hidden submit button's click event as a workaround
                    $('#hiddensubmit').click();
                }).change();
            });
        </script>
    <%} %>
    </div>
    <div id="preview"></div>
</asp:Content>
